<template>
    <div class="card">
        <!-- {{this.cardData}} -->
        <div class="block">
            <div v-if="this.cardData == ''" class="noEquipment"> 
                该项绑定设备未开启
            </div>
            <el-carousel trigger="click" class="card_hight" :autoplay="false" :initial-index="cardData.index" >
            <el-carousel-item v-for="item in cardData.unit" :key="item.index">
                <!-- 设备标题 -->
                <router-link to="/overview">
                    <h4 class="normal" @click="router('k8s_501',item)" :title="item.name">
                        <!-- <svg class="icon card_icon" aria-hidden="true">
                            <use xlink:href="#icon-jiedian"></use>
                        </svg> -->
                        <img class="title_icon" src="../../assets/title.png" alt />
                        {{item.typename}}:&nbsp;{{item.name}}
                    </h4>
                </router-link>
                <!-- 卡片内容 -->
                <div class="card_padding">
                    <ul>
                        <li class="li" v-for="(item2, index) in item.unit" :key="index" v-if="index < 8">
                            <div class="progress_title overflowHidden" v-if="item2.ready == 1">{{item2.name}}</div>
                            <el-progress :percentage="parseInt((item2.value/(item2.max-item2.min))*100 >= 100 ? 100 : (item2.value/(item2.max-item2.min))*100)||0 " :show-text="false" :stroke-width="14" v-if="item2.ready == 1"></el-progress>
                            <div class="progress_value overflowHidden" v-if="item2.ready == 1">{{item2.value.toFixed(0)}}{{item2.flag}}</div>
                        </li>
                    </ul>
                </div>
                 
            </el-carousel-item>
            </el-carousel>
        </div>
        
    </div>
</template>

<script>
export default {
    props: ['nowIndex', 'cardData', 'nowId'],
    data () {
        return{
        }
    },
    created() {
    },
    methods: {
        // 跳转
        router(val,item){
            var arr = {
                addr:item.addr,
                name:item.name,
                type:item.type,
                uid:item.uid
            }
            localStorage.setItem("当前设备编号", JSON.stringify(arr))
            localStorage.setItem("menuRouter", val)
        },
    },
     // 清除定时器
    beforeDestroy() {
    },
}
</script>

<style scoped>

/deep/ .el-carousel__container .el-carousel__arrow {
    height: 150px !important;
    width: 110px !important;
    border-radius: 0;
    background: none;
}
/deep/ .el-icon-arrow-left {
    margin-left: -110px !important;
}
/deep/ .el-icon-arrow-right{
    margin-right: -110px !important;
}
/deep/ .el-carousel__indicators{
    display: none;
}
.card_padding .item{
    width: 100%;
    height: 25px;
    float: left;
    /* text-align: center; */
    font-size: 18px;
    margin: 12px 0;
}
.normal .card_icon{
    font-size: 20px;
}
.li{
    display: flex;
    /* margin-bottom: 3px; */
}
/deep/ .progress_title {
    /* display: inline-block; */
    width: 130px;
    line-height: 24px;
    float: left;
    /* flex: 1; */
    font-size: 16px;

}
/deep/ .el-progress{
    padding: 4px 0;
    width: 300px;
    /* flex: 1; */
}
.progress_value{
    float: right;
    /* flex: 1; */
    text-indent: 20px;
    width: 130px;
    line-height: 26px;
    height: 28px;

}
/deep/ .el-progress-bar__outer{
    background: none;
    border: .5px solid rgba(89, 129, 165, 0.8);
}
/deep/ .li:nth-child(1) .el-progress-bar__inner{
    background: #328be8;
}
/deep/ .li:nth-child(2) .el-progress-bar__inner{
    background: #60b1e2;
}
/deep/ .li:nth-child(3) .el-progress-bar__inner{
    background: #328be8;
}
/deep/ .li:nth-child(4) .el-progress-bar__inner{
    background: #60b1e2;
}
/deep/ .card_padding {
    padding: 0px 20px 0px 30px !important;
}
.bottom{
    display: flex;
    margin-top: 10px;
    text-indent: 30px;
}
.bottom>div{
    flex: 1;
}
.bottom p{
    font-size: 34px;
    font-weight: 500;
}
.bottom .p2{
    color: #328be8;
}
.bottom .p3{
    color: #60b1e2;
}
.bottom .p1{
    color: #60b1e2;
    font-size: 26px;
    font-weight: 600;
    text-indent: 42px;
} 
.bottom p span{
    font-size: 16px;
    margin-left: 5px;
    color: #fff;
}
.bottom  h4{
    font-weight: 400;
}
</style>